﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FluentNHibernate.Mapping;
using NHibernate;
using FluentNHibernate.Data;

namespace BankCreditPortfolio.DAL.Entities
{
    public class Account
    {
        public virtual int AccountId { get; set; }
        public virtual string Email { get; set; }
        public virtual string Salt { get; set; }
        public virtual string Hash { get; set; }
        public virtual Role Role { get; set; }
    }

    public class AccountMap : ClassMap<Account>
    {
        public AccountMap()
        {
            Id(x => x.AccountId).GeneratedBy.HiLo("account");
            Id(x => x.AccountId).Unique();
            Map(x => x.Email);
            Map(x => x.Salt);
            Map(x => x.Hash);
            References(x => x.Role).Column("RoleId");
            Table("Account");
        }
    }
}
